package org.hp.service.patient;

import org.hp.bean.Patient;
import org.hp.dao.patient.PatientDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class PatientServiceimpl implements PatientService{
    @Resource
    PatientDao patientDao;

    @Override
    public List<Map<String, Object>> queryAll(Patient patient) {
        return patientDao.queryAll(patient);
    }

    @Override
    public boolean del(int pid) {
        int num=patientDao.del(pid);
        if (num>0){
            return true;
        }
        return false;
    }

    @Override
    public List<Map<String, Object>> queryDelAll() {
        return patientDao.queryDelAll();
    }

    @Override
    public boolean del2(int pid) {
        int num=patientDao.del2(pid);
        if (num>0){
            return true;
        }
        return false;
    }

    @Override
    public List<Map<String, Object>> queryDoctorAll() {
        return patientDao.queryDoctorAll();
    }

    @Override
    public boolean insert(Patient patient) {
        int num=patientDao.insert(patient);
        if (num>0){
            return true;
        }
        return false;
    }

    @Override
    public List<Map<String, Object>> queryOne(int pid) {
        return patientDao.queryOne(pid);
    }

    @Override
    public boolean upd(Patient patient) {
        int num=patientDao.upd(patient);
        System.out.println("num::"+num);
        if (num>0){
            return true;
        }
        return false;
    }

}
